//
//  KATSwitch.h
//  KATFramework
//
//  Created by Kantice on 14/11/6.
//  Copyright (c) 2014年 KatApp. All rights reserved.
//  开关

#import <UIKit/UIKit.h>
#import "KATSprite.h"
#import "KATColor.h"



@class KATSwitch;

@protocol KATSwitchDelegate <NSObject>


@optional

///状态改变
- (void)switchChanged:(BOOL)isON withSwitch:(KATSwitch *)sw;

@end



@interface KATSwitch : KATSprite


#pragma -mark 属性

///圆点
@property(nonatomic,retain) UIView *point;

///按钮
@property(nonatomic,retain) UIView *button;

///按钮色
@property(nonatomic,retain) UIColor *buttonColor;

///背景线
@property(nonatomic,retain) UIView *line;

///线高
@property(nonatomic,assign) float lineHeight;

///按钮边线宽度
@property(nonatomic,assign) float buttonBorderWidth;

///打开颜色
@property(nonatomic,retain) UIColor *onColor;

///关闭颜色
@property(nonatomic,retain) UIColor *offColor;

///动画时长
@property(nonatomic,assign) float animateTime;

///是否有点击事件
@property(nonatomic,assign) BOOL hasTapEvent;

///事件代理
@property(nonatomic,assign) id<KATSwitchDelegate> eventDelegate;

///是否打开
@property(nonatomic,assign) BOOL isOn;


#pragma -mark 类方法

///获取实例
+ (instancetype)switchWithFrame:(CGRect)frame;


#pragma -mark 对象方法

///初始化开关
- (void)initSwitch;

///打开
- (void)turnOn;

///关闭
- (void)turnOff;


///释放内存
- (void)dealloc;


@end



